#include <iostream>
#include <vector>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <fstream>
#include <string>
#include <queue>
#include <limits>
#include <map>

using namespace std;

struct Node
{
    char letter;
    bool is_leaf;
    Node* ss;
    Node* out;
    Node* parent;
    map<char, Node*> childs;
    explicit Node(char c)
    {
        letter = c;
        is_leaf = false;
        ss = 0;
        parent = 0;
        out = 0;
    }
};

class bor
{
    public:
        bor()
        {
            root = new Node(0);
            root->ss = root;
            root->out = root;
        }

        int includings(const string& s)
        {
            int res = 0;
            int i = 0;
            Node* curr = root;
            while (i < s.length())
            {
                char c = s[i];
                ++i;
                if (curr->childs[c] != 0) curr = curr->childs[c];
                else
                {
                    while (curr != root)
                    {
                        if (curr->childs[c] != 0)  break;
                        else curr = curr->ss;
                    }
                    if (curr->childs[c] != 0) curr=curr->childs[c];
                }
                Node* out_check = curr->out;
                while (out_check != root)
                {
                    ++res;
                    out_check = out_check->out;
                }
                if (curr->is_leaf) ++res;
            }
            return res;
        }

        void add(const string& word)
        {
            Node* curr = root;
            for (int i = 0; i < word.length() - 1; ++i)
            {
                if (curr->childs[word[i]] != 0) curr = curr->childs[word[i]];
                else
                {
                    Node* new_node = new Node(word[i]);
                    new_node->parent = curr;
                    curr->childs[word[i]] = new_node;
                    curr = new_node;
                    new_node->out = root;
                    new_node->ss = root;
                }
            }
            char last = word[word.length() - 1];
            if (curr->childs[last] != 0) curr->childs[last]->is_leaf = true;
            else
            {
                Node* new_node = new Node(last);
                new_node->ss = root;
                new_node->out = root;
                new_node->parent = curr;
                curr->childs[last] = new_node;
                new_node->is_leaf = true;
            }
        }

        void build_links()
        {
            queue<Node*> q;
            q.push(root);
            while (!q.empty())
            {
                Node* curr = q.front();
                q.pop();
                Node* link = curr->parent;
                if (link != 0 && link != root)
                {
                    do
                    {
                        if (link->ss->childs[(unsigned char)curr->letter] != 0)
                        {
                            curr->ss = link->ss->childs[(unsigned char)curr->letter];
                            break;
                        } else link = link->ss;
                    } while (link->ss != link);
                }
                if (curr->ss->is_leaf) curr->out = curr->ss;
                else curr->out = curr->ss->out;
                for (map<char, Node*>::iterator iter = curr->childs.begin(); iter != curr->childs.end(); ++iter)
                {
                    q.push(iter->second);
                }
            }
        }

        void print_tree()
        {
            queue<Node*> q;
            q.push(root);
            while (!q.empty())
            {
                Node* curr = q.front();
                q.pop();
                cout<<curr->letter<<endl;
                cout<<"linked_to "<<curr->ss->letter<<endl;
                for (map<char, Node*>::iterator iter = curr->childs.begin(); iter != curr->childs.end(); ++iter)
                {
                    if (iter->second != 0)
                    {
                        q.push(iter->second);
                        cout<<iter->second->letter<<' ';
                    }
                }
                cout<<"\nout is: "<<curr->out->letter;
                cout<<endl<<endl;
            }
        }

        ~bor()
        {
            delete_node(root);
        }

    private:
        void delete_node(Node* curr)
        {
            if (curr == 0) return;
            for (map<char, Node*>::iterator iter = curr->childs.begin(); iter != curr->childs.end(); ++iter)
            {
                delete_node(iter->second);
            }
            delete curr;
        }

        Node* root;
};

int main()
{
    freopen("input.txt", "r", stdin);
    bor new_bor;
    int n;
    cin>>n;
    for (int i = 0; i < n; ++i)
    {
        string s;
        cin>>s;
        new_bor.add(s);
    }
    new_bor.build_links();
    string text;
    cin>>text;
    cout<<new_bor.includings(text);
    return 0;
}
